﻿@model Realtors.Web.UI.Models.ContactForUnitViewModel

@{
    ViewBag.Title = "Send message for a listing";
}

<h2>Contact for a listing</h2>


<div class="row">
    @if ((ViewBag.SentMessage != null) && (ViewBag.SentMessage == true))
    {
        <div class="box">
            <div class="col-lg-6">
                <span class="label label-success">@Resources.ContactConfirmed</span>
            </div>
        </div>
    }
    <div class="box">
        <div class="col-lg-12">
            @using (Html.BeginForm("SendMessageForHouse", "Contact", FormMethod.Post, new { @class = "form" }))
            {
                <div class="row">
                    @Html.AntiForgeryToken()
                    @Html.ValidationSummary(true)
                    <div class="form-group col-lg-12">
                        Listing Name: @Model.UnitTitle
                        @Html.HiddenFor(model=>model.UnitID)
                    </div>
                    <div class="form-group col-lg-4">
                        <label for="EmailAddress">@Resources.EmailAddress</label>
                        @Html.TextBoxFor(model => model.EmailAddress, new { @class = "form-control" })
                        @Html.ValidationMessageFor(model => model.EmailAddress)
                    </div>
                    <div class="form-group col-lg-4">
                        <label for="PhoneNumber">@Resources.PhoneNumber</label>
                        @Html.TextBoxFor(model => model.PhoneNumber, new { @class = "form-control" })
                        @Html.ValidationMessageFor(model => model.PhoneNumber)
                    </div>
                    <div class="clearfix"></div>
                    <div class="form-group col-lg-12">
                        <label for="Message">@Resources.Message</label>
                        @Html.TextAreaFor(model => model.Message, new { @class = "form-control" })
                        @Html.ValidationMessageFor(model => model.Message)
                    </div>
                       
                    <div class="form-group col-lg-12">
                        <input type="hidden" name="save" value="contact">
                        <button type="submit" class="btn btn-default">Submit</button>
                    </div>
                </div>
            }

        </div>
    </div>
</div>
@section scripts{
    <script type='text/javascript'>
        $(document).ready(function () {
            var inp = $('.input-validation-error:first').get(0);

            if (inp) {
                inp.focus();
            }
        });
    </script>
}